--- /dev/null
+/*
+ Garmin icon tables
+ Based on information provided by Ian Cowley, Sigurd Humerfelt,
+ and Garmin MapSource
+
+ Copyright (C) 2003 Robert Lipe, robertlipe@usa.net
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
+ */
+
+typedef struct icon_mapping {
+ const int mpssymnum;
+ const int pcxsymnum;
+ const char *icon;
+} icon_mapping_t;
+
+typedef enum {MAPSOURCE, PCX, GARMIN_SERIAL} garmin_formats_e;
+
+extern const
+char *mps_find_desc_from_icon_number(const int icon,
+ garmin_formats_e garmin_format);
+
+/* MapSource 4.13 */
+static icon_mapping_t icon_table[] = {
+/* mps pcx desc */
+ { 107, 16384, "Airport" },
+ { 73, 8204, "Amusement Park" },
+ { 55, 169, "Ball Park" },
+ { 6, 6, "Bank" },
+ { 13, 13, "Bar" },
+ { 104, 8244, "Beach" },
+ { 1, 1, "Bell" },
+ { 37, 150, "Boat Ramp" },
+ { 74, 8205, "Bowling" },
+ { 93, 8233, "Bridge" },
+ { 94, 8234, "Building" },
+ { 38, 151, "Campground" },
+ { 56, 170, "Car" },
+ { 75, 8206, "Car Rental" },
+ { 76, 8207, "Car Repair" },
+ { 95, 8235, "Cemetery" },
+ { 96, 8236, "Church" },
+ { 65, 179, "Circle with X" },
+ { 72, 8203, "City (Capitol)" },
+ { 71, 8200, "City (Large)" },
+ { 70, 8199, "City (Medium)" },
+ { 69, 8198, "City (Small)" },
+ { 97, 8237, "Civil" },
+ { 119, 8262, "Contact, Afro" },
+ { 120, 8272, "Contact, Alien" },
+ { 121, 8258, "Contact, Ball Cap" },
+ { 122, 8259, "Contact, Big Ears" },
+ { 123, 8271, "Contact, Biker" },
+ { 124, 8273, "Contact, Bug" },
+ { 125, 8274, "Contact, Cat" },
+ { 126, 8275, "Contact, Dog" },
+ { 127, 8263, "Contact, Dreadlocks" },
+ { 128, 8264, "Contact, Female1" },
+ { 129, 8265, "Contact, Female2" },
+ { 130, 8266, "Contact, Female3" },
+ { 131, 8261, "Contact, Goatee" },
+ { 132, 8268, "Contact, Kung-Fu" },
+ { 133, 8276, "Contact, Pig" },
+ { 134, 8270, "Contact, Pirate" },
+ { 135, 8267, "Contact, Ranger" },
+ { 136, 8257, "Contact, Smiley" },
+ { 137, 8260, "Contact, Spike" },
+ { 138, 8269, "Contact, Sumo" },
+ { 52, 165, "Controlled Area" },
+ { 89, 8220, "Convenience Store" },
+ { 98, 8238, "Crossing" },
+ { 51, 164, "Dam" },
+ { 53, 166, "Danger Area" },
+ { 87, 8218, "Department Store" },
+ { 4, 4, "Diver Down Flag 1" },
+ { 5, 5, "Diver Down Flag 2" },
+ { 41, 154, "Drinking Water" },
+ { 63, 177, "Exit" },
+ { 77, 8208, "Fast Food" },
+ { 7, 7, "Fishing Area" },
+ { 78, 8209, "Fitness Center" },
+ { 64, 178, "Flag" },
+ { 105, 8245, "Forest" },
+ { 8, 8, "Gas Station" },
+ { 117, 8255, "Geocache" },
+ { 118, 8256, "Geocache Found" },
+ { 99, 8239, "Ghost Town" },
+ { 113, 16393, "Glider Area" },
+ { 68, 8197, "Golf Course" },
+ { 2, 2, "Green Diamond" },
+ { 15, 15, "Green Square" },
+ { 108, 16388, "Heliport" },
+ { 9, 9, "Horn" },
+ { 57, 171, "Hunting Area" },
+ { 44, 157, "Information" },
+ { 100, 8240, "Levee" },
+ { 12, 12, "Light" },
+ { 90, 8221, "Live Theater" },
+ { 59, 173, "Lodging" },
+ { 20, 21, "Man Overboard" },
+ { 0, 0, "Marina" },
+ { 43, 156, "Medical Facility" },
+ { 66, 8195, "Mile Marker" },
+ { 101, 8241, "Military" },
+ { 60, 174, "Mine" },
+ { 79, 8210, "Movie Theater" },
+ { 80, 8211, "Museum" },
+ { 21, 22, "Navaid, Amber" },
+ { 22, 23, "Navaid, Black" },
+ { 23, 24, "Navaid, Blue" },
+ { 24, 25, "Navaid, Green" },
+ { 25, 26, "Navaid, Green/Red" },
+ { 26, 27, "Navaid, Green/White" },
+ { 27, 28, "Navaid, Orange" },
+ { 28, 29, "Navaid, Red" },
+ { 29, 30, "Navaid, Red/Green" },
+ { 30, 31, "Navaid, Red/White" },
+ { 31, 32, "Navaid, Violet" },
+ { 32, 33, "Navaid, White" },
+ { 33, 34, "Navaid, White/Green" },
+ { 34, 35, "Navaid, White/Red" },
+ { 102, 8242, "Oil Field" },
+ { 115, 16395, "Parachute Area" },
+ { 46, 159, "Park" },
+ { 45, 158, "Parking Area" },
+ { 81, 8212, "Pharmacy" },
+ { 47, 160, "Picnic Area" },
+ { 82, 8213, "Pizza" },
+ { 83, 8214, "Post Office" },
+ { 109, 16389, "Private Field" },
+ { 36, 37, "Radio Beacon" },
+ { 3, 3, "Red Diamond" },
+ { 16, 16, "Red Square" },
+ { 10, 10, "Residence" },
+ { 11, 11, "Restaurant" },
+ { 54, 167, "Restricted Area" },
+ { 39, 152, "Restroom" },
+ { 84, 8215, "RV Park" },
+ { 91, 8226, "Scales" },
+ { 48, 161, "Scenic Area" },
+ { 85, 8216, "School" },
+ { 116, 16402, "Seaplane Base" },
+ { 19, 19, "Shipwreck" },
+ { 58, 172, "Shopping Center" },
+ { 112, 16392, "Short Tower" },
+ { 40, 153, "Shower" },
+ { 49, 162, "Skiing Area" },
+ { 14, 14, "Skull and Crossbones" },
+ { 110, 16390, "Soft Field" },
+ { 86, 8217, "Stadium" },
+ { 106, 8246, "Summit" },
+ { 50, 163, "Swimming Area" },
+ { 111, 16391, "Tall Tower" },
+ { 42, 155, "Telephone" },
+ { 92, 8227, "Toll Booth" },
+ { 67, 8196, "TracBack Point" },
+ { 61, 175, "Trail Head" },
+ { 62, 176, "Truck Stop" },
+ { 103, 8243, "Tunnel" },
+ { 114, 16394, "Ultralight Area" },
+ { 18, 18, "Waypoint" },
+ { 17, 17, "White Buoy" },
+ { 35, 36, "White Dot" },
+ { 88, 8219, "Zoo" },
+ { -1, -1, NULL },
+};
#include <string.h>
#include "defs.h"
+#include "garmin_tables.h"
#include <ctype.h>
static FILE *mps_file_in;
0x02, 0x00, 0x00, 0x00, 0x56, 0x00, 0x01
};
-typedef struct icon_mapping {
- const int symnum;
- const char *icon;
-} icon_mapping_t;
-
-static icon_mapping_t icon_table[] = {
- { 107, "Airport" },
- { 73, "Amusement Park" },
- { 55, "Ball Park" },
- { 6, "Bank" },
- { 13, "Bar" },
- { 104, "Beach" },
- { 1, "Bell" },
- { 37, "Boat Ramp" },
- { 74, "Bowling" },
- { 93, "Bridge" },
- { 94, "Building" },
- { 38, "Campground" },
- { 56, "Car" },
- { 75, "Car Rental" },
- { 76, "Car Repair" },
- { 95, "Cemetery" },
- { 96, "Church" },
- { 65, "Circle with X" },
- { 72, "City (Capitol)" },
- { 71, "City (Large)" },
- { 70, "City (Medium)" },
- { 69, "City (Small)" },
- { 97, "Civil" },
- { 119, "Contact, Afro" },
- { 120, "Contact, Alien" },
- { 121, "Contact, Ball Cap" },
- { 122, "Contact, Big Ears" },
- { 123, "Contact, Biker" },
- { 124, "Contact, Bug" },
- { 125, "Contact, Cat" },
- { 126, "Contact, Dog" },
- { 127, "Contact, Dreadlocks" },
- { 128, "Contact, Female1" },
- { 129, "Contact, Female2" },
- { 130, "Contact, Female3" },
- { 131, "Contact, Goatee" },
- { 132, "Contact, Kung-Fu" },
- { 133, "Contact, Pig" },
- { 134, "Contact, Pirate" },
- { 135, "Contact, Ranger" },
- { 136, "Contact, Smiley" },
- { 137, "Contact, Spike" },
- { 138, "Contact, Sumo" },
- { 52, "Controlled Area" },
- { 89, "Convenience Store" },
- { 98, "Crossing" },
- { 51, "Dam" },
- { 53, "Danger Area" },
- { 87, "Department Store" },
- { 4, "Diver Down Flag 1" },
- { 5, "Diver Down Flag 2" },
- { 41, "Drinking Water" },
- { 63, "Exit" },
- { 77, "Fast Food" },
- { 7, "Fishing Area" },
- { 78, "Fitness Center" },
- { 64, "Flag" },
- { 105, "Forest" },
- { 8, "Gas Station" },
- { 117, "Geocache" },
- { 118, "Geocache Found" },
- { 99, "Ghost Town" },
- { 113, "Glider Area" },
- { 68, "Golf Course" },
- { 2, "Green Diamond" },
- { 15, "Green Square" },
- { 108, "Heliport" },
- { 9, "Horn" },
- { 57, "Hunting Area" },
- { 44, "Information" },
- { 100, "Levee" },
- { 12, "Light" },
- { 90, "Live Theater" },
- { 59, "Lodging" },
- { 20, "Man Overboard" },
- { 0, "Marina" },
- { 43, "Medical Facility" },
- { 66, "Mile Marker" },
- { 101, "Military" },
- { 60, "Mine" },
- { 79, "Movie Theater" },
- { 80, "Museum" },
- { 21, "Navaid, Amber" },
- { 22, "Navaid, Black" },
- { 23, "Navaid, Blue" },
- { 24, "Navaid, Green" },
- { 25, "Navaid, Green/Red" },
- { 26, "Navaid, Green/White" },
- { 27, "Navaid, Orange" },
- { 28, "Navaid, Red" },
- { 29, "Navaid, Red/Green" },
- { 30, "Navaid, Red/White" },
- { 31, "Navaid, Violet" },
- { 32, "Navaid, White" },
- { 33, "Navaid, White/Green" },
- { 34, "Navaid, White/Red" },
- { 102, "Oil Field" },
- { 115, "Parachute Area" },
- { 46, "Park" },
- { 45, "Parking Area" },
- { 81, "Pharmacy" },
- { 47, "Picnic Area" },
- { 82, "Pizza" },
- { 83, "Post Office" },
- { 109, "Private Field" },
- { 36, "Radio Beacon" },
- { 3, "Red Diamond" },
- { 16, "Red Square" },
- { 10, "Residence" },
- { 11, "Restaurant" },
- { 54, "Restricted Area" },
- { 39, "Restroom" },
- { 84, "RV Park" },
- { 91, "Scales" },
- { 48, "Scenic Area" },
- { 85, "School" },
- { 116, "Seaplane Base" },
- { 19, "Shipwreck" },
- { 58, "Shopping Center" },
- { 112, "Short Tower" },
- { 40, "Shower" },
- { 49, "Skiing Area" },
- { 14, "Skull and Crossbones" },
- { 110, "Soft Field" },
- { 86, "Stadium" },
- { 106, "Summit" },
- { 50, "Swimming Area" },
- { 111, "Tall Tower" },
- { 42, "Telephone" },
- { 92, "Toll Booth" },
- { 67, "TracBack Point" },
- { 61, "Trail Head" },
- { 62, "Truck Stop" },
- { 103, "Tunnel" },
- { 114, "Ultralight Area" },
- { 18, "Waypoint" },
- { 17, "White Buoy" },
- { 35, "White Dot" },
- { 88, "Zoo" },
- { -1, NULL },
-};
-
char *snlen;
static
};
const char *
-mps_find_desc_from_icon_number(const int icon)
+mps_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format)
{
icon_mapping_t *i;
for (i = icon_table; i->icon; i++) {
- if (icon == i->symnum) {
- return i->icon;
+ switch (garmin_format) {
+ case MAPSOURCE:
+ if (icon == i->mpssymnum)
+ return i->icon;
+ break;
+ case PCX:
+ case GARMIN_SERIAL:
+ if (icon == i->pcxsymnum)
+ return i->icon;
+ break;
+ default:
+ fatal(MYNAME ": unknown garmin format");
}
}
return "Waypoint";
}
int
-mps_find_icon_number_from_desc(const char *desc)
+mps_find_icon_number_from_desc(const char *desc, garmin_formats_e garmin_format)
{
icon_mapping_t *i;
int def_icon = 18;
for (i = icon_table; i->icon; i++) {
if (case_ignore_strcmp(desc,i->icon) == 0) {
- return i->symnum;
+ switch (garmin_format) {
+ case MAPSOURCE:
+ return i->mpssymnum;
+ case PCX:
+ case GARMIN_SERIAL:
+ return i->pcxsymnum;
+ default:
+ fatal(MYNAME ": unknown garmin format");
+ }
}
}
return def_icon;
wpt->description = xstrdup(wptdesc);
wpt->position.latitude.degrees = lat / 2147483648.0 * 180.0;
wpt->position.longitude.degrees = lon / 2147483648.0 * 180.0;
- wpt->icon_descr = mps_find_desc_from_icon_number(icon);
+ wpt->icon_descr = mps_find_desc_from_icon_number(icon, MAPSOURCE);
waypt_add(wpt);
#ifdef DUMP_ICON_TABLE
memset(zbuf, 0, sizeof(zbuf));
memset(ffbuf, 0xff, sizeof(ffbuf));
- icon = mps_find_icon_number_from_desc(wpt->icon_descr);
+ icon = mps_find_icon_number_from_desc(wpt->icon_descr, MAPSOURCE);
if (get_cache_icon(wpt)) {
- icon = mps_find_icon_number_from_desc(get_cache_icon(wpt));
+ icon = mps_find_icon_number_from_desc(get_cache_icon(wpt), MAPSOURCE);
}
le_write32(&reclen, reclen);